package com.jinyi.wwdeng.autodialer.data

import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase

@Database(entities = [CallTaskEntity::class], version = 1,exportSchema = false)
abstract class CallDatabase: RoomDatabase() {
    abstract fun callDao(): CallTaskDao

    companion object {
        @Volatile
        private var INSTANCE: CallDatabase? = null
        fun getInstance(context: Context): CallDatabase {
            return INSTANCE ?: synchronized(this) {
                val instance = Room.databaseBuilder(context.applicationContext, CallDatabase::class.java, "auto_dialer_db").build()
                INSTANCE = instance
                instance
            }
        }
    }
}